<script type="text/javascript">
    $(document).ready(function(){
        $("#submit").click(function(){
            submitForm('#editForm',"<?php echo url('banner'); ?>"); 
        });
    });
</script>
<!--banner编辑页面-->
<div>
    <hr>
    <ul class="breadcrumb">
        <li>
            <a href="#">banner</a> <span class="divider">|</span>
        </li>
        <li>
            <a href="#">编辑</a>
        </li>
    </ul>
    <hr>
</div>
<div class="row-fluid sortable">
    <div class="box span12">
        <div class="box-header" data-original-title>
            <h2><i class="icon-edit"></i><span class="break"></span>banner</h2>
            <div class="box-icon">
                <a href="#" class="btn-setting"><i class="icon-wrench"></i></a>
                <a href="#" class="btn-minimize"><i class="icon-chevron-up"></i></a>
                <a href="#" class="btn-close"><i class="icon-remove"></i></a>
            </div>
        </div>
        <div class="box-content">
            <form class="form-horizontal"  action="<?php echo url('banner/edit'); ?>" method="post" id="editForm">
                <?php
                if (in_array($type, array(service_type::BANNER, service_type::SLIDE))):
                    $title = service_type::getName($type);
                    $url = url('banner?type=' . $type);
                    ?>
                    <input type="hidden" name="banner[typeID]" value="<?php echo $type; ?>" />
                    <?php
                else:
                    $title = "banner图片";
                    $url = url('banner');
                    ?>
                    <fieldset>
                        <div class="control-group">
                            <label class="control-label" for="typeahead">banner分类: </label>
                            <div class="controls">                                
                                <select name="banner[typeID]" >
                                    <option <?php if ($image['typeID'] == service_type::BANNER) echo 'selected="selected"'; ?> value="<?php echo service_type::BANNER; ?>">
                                        <?php echo service_type::getName(service_type::BANNER); ?>
                                    </option>
                                    <option <?php if ($image['typeID'] == service_type::SLIDE) echo 'selected="selected"'; ?> value="<?php echo service_type::SLIDE; ?>">
                                        <?php echo service_type::getName(service_type::SLIDE); ?>
                                    </option>
                                </select>
                            </div>
                        </div>    
                    <?php endif; ?>
                    <div class="control-group">
                        <label class="control-label" for="typeahead">图片</label>
                        <div class="controls">
                            	<?php echo fetch('uploadImg', array('limit' => 1,'images'=>array($image))); ?>
                        </div>
                    </div> 
                    <div class="control-group ">
                        <label class="control-label" for="">图片名称</label>
                        <div class="controls">
                            <input type="text" name="banner[title]" value="<?php echo $image['title']; ?>" />
                        </div>
                    </div>
                    <div class="control-group ">
                        <label class="control-label" for="">排序ID</label>
                        <div class="controls">
                            <input type="text" class="digits" name="banner[sortID]" value="<?php echo $image['sortID']; ?>" />
                        </div>
                    </div>
                    <div class="control-group ">
                        <label class="control-label" for="textarea2">链接地址</label>
                        <div class="controls">          
                            <input type="text" name="banner[url]" value="<?php echo $image['url']; ?>" />
                        </div>
                    </div>
                    <div class="form-actions">
                        <input type="submit" value="修改"   id="submit" class="btn btn-primary" />
                        <input type="hidden" name="id" value="<?php echo $image['id']; ?>" />
                        <button type="reset" class="btn">取消</button>
                    </div>
                </fieldset>
            </form>   
        </div>
    </div>
</div>
<script type="text/javascript">
    $(document).ready(function(){
        $("#submit").click(function(){
            submitForm('#editForm',"<?php echo url('banner'); ?>");
        });
    });
</script>
